package xyz.lwm.lazycat.transaction.policy;

import xyz.lwm.lazycat.transaction.execute.TranDefinition;

/**
 * 若存在当前事务，则加入当前事务，若不存在当前事务，则以非事务的方式运行
 *
 * @author lwm
 * @see xyz.lwm.lazycat.transaction.execute.Propagation#SUPPORTS
 */
class SupportsPolicy extends AbstractPolicy {

    public SupportsPolicy(TranDefinition tranDefinition) {
        super(tranDefinition);
    }

    @Override
    public <T> T execute(CheckedSupplier<T> supplier) throws Throwable {
        return supplier.get();
    }

}
